<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>File: app_wide_methods.rb</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



  <div id="fileHeader">
    <h1>app_wide_methods.rb</h1>
    <table class="header-table">
    <tr class="top-aligned-row">
      <td><strong>Path:</strong></td>
      <td>app_wide_methods.rb
      </td>
    </tr>
    <tr class="top-aligned-row">
      <td><strong>Last Update:</strong></td>
      <td>Thu Jun 21 19:04:59 India Standard Time 2007</td>
    </tr>
    </table>
  </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">


    <div id="requires-list">
      <h3 class="section-bar">Required files</h3>

      <div class="name-list">
      fasterCSV&nbsp;&nbsp;
      pathname&nbsp;&nbsp;
      </div>
    </div>

   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000011">create_global_connection_file</a>&nbsp;&nbsp;
      <a href="#M000009">create_new_connection</a>&nbsp;&nbsp;
      <a href="#M000013">create_structure_csv_file</a>&nbsp;&nbsp;
      <a href="#M000010">extract_connection_options</a>&nbsp;&nbsp;
      <a href="#M000007">first_letter_capital</a>&nbsp;&nbsp;
      <a href="#M000008">generate_header_file</a>&nbsp;&nbsp;
      <a href="#M000003">get_columns_from_numbers</a>&nbsp;&nbsp;
      <a href="#M000002">get_columns_from_positions</a>&nbsp;&nbsp;
      <a href="#M000005">get_possible_primary_key</a>&nbsp;&nbsp;
      <a href="#M000012">get_root_tables</a>&nbsp;&nbsp;
      <a href="#M000001">get_the_col_spec_for_single_col</a>&nbsp;&nbsp;
      <a href="#M000014">get_the_col_specs</a>&nbsp;&nbsp;
      <a href="#M000004">handle_primary_key</a>&nbsp;&nbsp;
      <a href="#M000006">primary_key_column_exists</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000011" class="method-detail">
        <a name="M000011"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000011.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000011.html');return false;">
          <span class="method-name">create_global_connection_file</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This file create the global_connection.csv This file is refernced everytime
an ETL task is run. Any changes in the file will be picked up from the next
task run.
</p>
        </div>
      </div>

      <div id="method-M000009" class="method-detail">
        <a name="M000009"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000009.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000009.html');return false;">
          <span class="method-name">create_new_connection</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Establishes a new connection based on the options given in the cofig file.
This method also checks the configuration options and throws an error if
none can be found.
</p>
        </div>
      </div>

      <div id="method-M000013" class="method-detail">
        <a name="M000013"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000013.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000013.html');return false;">
          <span class="method-name">create_structure_csv_file</span><span class="method-args">(table_name,new_connection)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This file creates the structure file of the root table. Useful in all the
transformations.
</p>
        </div>
      </div>

      <div id="method-M000010" class="method-detail">
        <a name="M000010"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000010.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000010.html');return false;">
          <span class="method-name">extract_connection_options</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method is extractin connection options from the global_connection.csv
</p>
        </div>
      </div>

      <div id="method-M000007" class="method-detail">
        <a name="M000007"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000007.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000007.html');return false;">
          <span class="method-name">first_letter_capital</span><span class="method-args">(field_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method converts the primary key name into camel case for comparison.
</p>
        </div>
      </div>

      <div id="method-M000008" class="method-detail">
        <a name="M000008"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000008.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000008.html');return false;">
          <span class="method-name">generate_header_file</span><span class="method-args">(tablename,connection)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
If the table where data is to be loaded already exists then its headers are
extracted so that insert data into correct columns.
</p>
        </div>
      </div>

      <div id="method-M000003" class="method-detail">
        <a name="M000003"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000003.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000003.html');return false;">
          <span class="method-name">get_columns_from_numbers</span><span class="method-args">(number_array,all_columns)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Given the column numbers and the list of columns, this method determines
what are the columns matching these positions.
</p>
        </div>
      </div>

      <div id="method-M000002" class="method-detail">
        <a name="M000002"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000002.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000002.html');return false;">
          <span class="method-name">get_columns_from_positions</span><span class="method-args">(value,all_columns)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Given the relative position and the list of columns, this method determines
what are the columns matching these positions.
</p>
        </div>
      </div>

      <div id="method-M000005" class="method-detail">
        <a name="M000005"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000005.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000005.html');return false;">
          <span class="method-name">get_possible_primary_key</span><span class="method-args">(primary_key,table_name,connection)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Given the table name and the primary key title, this method determines
which column can be a primary key based on simple heuristics.
</p>
        </div>
      </div>

      <div id="method-M000012" class="method-detail">
        <a name="M000012"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000012.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000012.html');return false;">
          <span class="method-name">get_root_tables</span><span class="method-args">(filename)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method extracts names of all the root tables. Important while doing
the normalization transforms.
</p>
        </div>
      </div>

      <div id="method-M000001" class="method-detail">
        <a name="M000001"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000001.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000001.html');return false;">
          <span class="method-name">get_the_col_spec_for_single_col</span><span class="method-args">(column_name,table_name,new_connection)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method gets the column specifications of a single column from the root
table. This is useful while transformations mainly column transforms.
</p>
        </div>
      </div>

      <div id="method-M000014" class="method-detail">
        <a name="M000014"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000014.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000014.html');return false;">
          <span class="method-name">get_the_col_specs</span><span class="method-args">(column_name,table_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method is similar to the first method in this file. The only
difference is it generates the CSV file for all the columns in a table.
</p>
        </div>
      </div>

      <div id="method-M000004" class="method-detail">
        <a name="M000004"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000004.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000004.html');return false;">
          <span class="method-name">handle_primary_key</span><span class="method-args">(first_table_primary_key,first_table,new_connection)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method is handling some primary key related scenarios. These are as
follows:
</p>
<ol>
<li>In the first_table the primary key is already there and is diff from the
one mentioned by user.

</li>
<li>In the first_table the primary key is already there and is same as the one
mentioned by user.

</li>
<li>In the first_table there is no primary key.

</li>
<li>In the first_table the column mentioned by user is already there but it is
not the primary key.

</li>
</ol>
        </div>
      </div>

      <div id="method-M000006" class="method-detail">
        <a name="M000006"></a>

        <div class="method-heading">
          <a href="app_wide_methods_rb.src/M000006.html" target="Code" class="method-signature"
            onclick="popupCode('app_wide_methods_rb.src/M000006.html');return false;">
          <span class="method-name">primary_key_column_exists</span><span class="method-args">(primary_key,table,new_connection)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method verifies if the primary key mentioned in the config file is
actually there in the table. This method ensures that application generates
id as a default primary key in case of a missing primary key.
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>